<?php
/**
 * Created by PhpStorm.
 * User: 国小果
 * Date: 2022/11/16
 * Time: 9:54
 */

use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;

class AddMenu extends Migrator
{
    /**
     * 新增菜单
     */
    public function change()
    {
        $table = $this->table('menu');

        $default[] = [
            'id'          => '15',
            'name'        => '直播管理',
            'parent_id'   => 0,
            'weight'      => 1,
            'icon'        => 'layui-icon-auz',
            'uri'         => '',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'id'          => '16',
            'name'        => '主播管理',
            'parent_id'   => 0,
            'weight'      => 1,
            'icon'        => 'layui-icon-video',
            'uri'         => '',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'id'          => '17',
            'name'        => '广告管理',
            'parent_id'   => 0,
            'weight'      => 1,
            'icon'        => 'layui-icon-fire',
            'uri'         => '',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'id'          => '18',
            'name'        => '内容管理',
            'parent_id'   => 0,
            'weight'      => 1,
            'icon'        => 'layui-icon-form',
            'uri'         => '',
            'create_time' => time(),
            'update_time' => time(),
        ];


        $default[] = [
            'name'        => '消息管理',
            'parent_id'   => 15,
            'weight'      => 99,
            'icon'        => '',
            'uri'         => '/backmanage/message/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '标签管理',
            'parent_id'   => 15,
            'weight'      => 99,
            'icon'        => '',
            'uri'         => '/backmanage/tags/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '常用语管理',
            'parent_id'   => 15,
            'weight'      => 99,
            'icon'        => '',
            'uri'         => '/backmanage/shortcut/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '直播记录',
            'parent_id'   => 15,
            'weight'      => 1,
            'icon'        => '',
            'uri'         => '/backmanage/live_history/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '流量余额管理',
            'parent_id'   => 15,
            'weight'      => 2,
            'icon'        => '',
            'uri'         => '/backmanage/message/index',//todo 待完成
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '特效管理',
            'parent_id'   => 15,
            'weight'      => 3,
            'icon'        => '',
            'uri'         => '/backmanage/special_effects/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '敏感词汇管理',
            'parent_id'   => 15,
            'weight'      => 3,
            'icon'        => '',
            'uri'         => '/backmanage/sensitive_words/index',
            'create_time' => time(),
            'update_time' => time(),
        ];

        $default[] = [
            'name'        => '用户管理',
            'parent_id'   => 5,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/member/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '主播认证',
            'parent_id'   => 16,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/member_auth/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => 'banner广告管理',
            'parent_id'   => 17,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/banner/index',
            'create_time' => time(),
            'update_time' => time(),
        ];

        $default[] = [
            'name'        => '限制地区配置表',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/region/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '建议反馈',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/feedback/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '反馈类型管理',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/feedback_type/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '投诉管理',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/complaint/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '投诉类型管理',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/complaint_type/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => 'app版本管理',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/version/index',
            'create_time' => time(),
            'update_time' => time(),
        ];

        $default[] = [
            'name'        => '配置管理',
            'parent_id'   => 1,
            'weight'      => 0,
            'icon'        => '',
            'uri'         => '/backmanage/config/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '流量充值金额列表',
            'parent_id'   => 15,
            'weight'      => 0,
            'icon'        => '',
            'uri'         => '/backmanage/flow_up_num/index',
            'create_time' => time(),
            'update_time' => time(),
        ];
        $default[] = [
            'name'        => '用户帮助列表',
            'parent_id'   => 18,
            'weight'      => 8,
            'icon'        => '',
            'uri'         => '/backmanage/help_list/index',
            'create_time' => time(),
            'update_time' => time(),
        ];


        $table->insert($default);
        $table->saveData();
    }
}
